package com.wyx.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wyx.anno.State;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.time.LocalDateTime;

@Data
public class Article {
    private Integer id;
    @NotEmpty
    @Pattern(regexp = "^\\S{1,20}$")
    private String title;
    @NotEmpty
    private String content;
    @URL
    @NotEmpty
    private String cover;
    @State // 自定义校验state参数
    private String state;
    private Integer createUser;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    public interface add {}
}
